package SM.UI.Controls;

public class TextBox extends Widget{

	private boolean isReadonly = false;
	private String Value = "";
	
	/*Constructor*/
	
	public TextBox()
	{
		super();
	}
	
	public TextBox(String name, int width)
	{
		super(name, width);
	}
	
	public TextBox(String name, int width, String style)
	{
		super(name, width,style);
	}
	
	public void SetReadOnly()
	{
		this.isReadonly = true;
	}
	
	public boolean IsReadonly()
	{
		return this.isReadonly;
	}
	
	public void SetValue(String value)
	{
		this.Value = value;
	}
	
	public String GetValue()
	{
		return this.Value;
	}
	
	public String getHTML()
	{
		String readOnly = (this.isReadonly) ? "readonly" : "";
		String Class = (super.GetStyle().equals("")) ? "" : super.GetStyle();
		
		String DisplayString = "<input type='text' name = '" + super.GetName() + "' size = " + super.GetWidth() + " value = '" + this.Value + "' class = '" + Class + "' " + readOnly + "/>";
		
		return DisplayString;
	}
}
